<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <h:form id="frmTitle">
        <p:growl id="msgs" showDetail="false"/>
        <h:panelGrid columns="2" cellpadding="1">
            <h:outputText value="#{msgs.etapaTituloLista}" styleClass="fontTitle"/>
        </h:panelGrid>
    </h:form>
        
    <h:panelGrid columns="2" width="100%">
        
        <h:form id="frmSearch">
            
            <h:panelGrid columns="3">
                
                <p:commandLink id="refreshTable" actionListener="#{etapaMB.atualizarTabela}" title="#{msgs.btnAtualizar}"  update=":frmDataTable:tbl" >
                    <h:graphicImage value="img/refresh.png" style="border: 0" />
                </p:commandLink>
                    
                <p:inputText id="txtBusca" value="#{etapaMB.busca}" size="35" />
                <p:commandButton id="btnSearch" value="#{msgs.btnBuscar}" alt="#{msgs.btnBuscar}" title="#{msgs.btnBuscar}" actionListener="#{etapaMB.buscar}" icon="ui-icon ui-icon-search" update=":frmDataTable:tbl"/>
                    
            </h:panelGrid>
                
        </h:form>
            
    </h:panelGrid>

    <h:form id="frmDataTable">

        <p:fieldset legend="#{msgs.statusLgdLista}">

            <h:panelGrid width="100%">            

                <p:dataTable id="tbl" var="tbl" paginator="true" paginatorPosition="bottom" rowsPerPageTemplate="5,10,15" rows="10"
                             emptyMessage="#{msgs.msgTabelaVazia}" value="#{etapaMB.lsetapa}">
                    <f:facet name="header">
                        <h:outputText value="#{msgs.etapaTblTitulo}"/>                    
                    </f:facet>
                       
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{msgs.descricao}"/>
                        </f:facet>
                        <h:outputText value="#{tbl.descricao}"/>
                    </p:column>
                    
                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{msgs.status}"/>
                        </f:facet>
                        <h:outputText value="#{tbl.status.descricao}"/>
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="#{msgs.colDtCriacao}"/>
                        </f:facet>
                        <h:outputText value="#{tbl.dtcriacao}">
                            <f:convertDateTime pattern="dd/MM/yyyy"/>
                        </h:outputText>
                    </p:column>

                    <p:column style="width:160px">
                        <p:commandButton id="btnEditar"  alt="#{msgs.btnEditar}" title="#{msgs.btnEditar}" icon="ui-icon ui-icon-pencil" action="#{etapaMB.editar}" ajax="false" >
                            <f:param id="idetapa" name="idetapa" value="#{tbl.id}"/>
                        </p:commandButton>
                        
                        <p:commandButton id="btnVisualizar" alt="#{msgs.btnVisualizar}" title="#{msgs.btnVisualizar}" icon="ui-icon ui-icon-search" oncomplete="dlgVisualizar.show()" actionListener="#{etapaMB.visualizar(tbl)}" update=":frmVisualizar" />
                   
                    </p:column>
                   
                </p:dataTable>
            
            </h:panelGrid>
            
        </p:fieldset>
            
    </h:form>

    <h:form id="frmVisualizar">

            <p:dialog header="#{msgs.visualizar}" widgetVar="dlgVisualizar" width="750"  resizable="false" modal="true" styleClass="styleDialog">
            
            <p:tabView id="idTab">

                <p:tab title="#{msgs.etapaDlgLgdVisualizar}">

                    <h:panelGrid columns="2">
                            
                            <h:outputLabel value="#{msgs.descricao}: "/>
                            <h:outputText value="#{etapaMB.strdescricao}"/>
                            
                            <h:outputLabel value="#{msgs.departamento}: "/>
                            <h:outputText value="#{etapaMB.strdepartamento}"/>
                            
                            <h:outputLabel value="#{msgs.processo}: "/>
                            <h:outputText value="#{etapaMB.strprocesso}"/>
                            
                            <h:outputLabel value="#{msgs.status}: "/>
                            <h:outputText value="#{etapaMB.strstatus}"/>
                            
                            <h:outputLabel value="#{msgs.dtcriacao}: "/>
                            <h:outputText value="#{etapaMB.strdtcriacao}">
                                <f:convertDateTime pattern="dd/MM/yyyy"/>
                            </h:outputText>
                            
                        </h:panelGrid>
                        
                                    
                    <p:commandButton style="width:90px;margin-bottom: 10px;margin-top: 10px;" value="#{msgs.btnFechar}" alt="#{msgs.btnFechar}" title="#{msgs.btnFechar}" onclick="dlgVisualizar.hide()" styleClass="centerButton"/>
                </p:tab>
              
                <p:tab title="Processos da Etapa">
                    
                         <h:panelGrid columns="1" width="100%">

                             <p:dataTable id="tblProcessoAdd" var="tbl" value="#{etapaMB.lsprocessoadd}" rows="5" paginator="true"
                                          emptyMessage="#{msgs.msgTabelaVazia}" paginatorPosition="bottom">  
                                     
                                 <f:facet name="header">
                                     <h:outputText value="#{msgs.processoTblTitulo}"/>                    
                                 </f:facet>
                            
                                 <p:column>
                                     <f:facet name="header">
                                         <h:outputText value="#{msgs.orientacao}"/>
                                     </f:facet>
                                     <h:outputText value="#{tbl.orientacao}"/>
                                 </p:column>
                            
                             </p:dataTable>  
                        
                             <h:panelGrid>
                                 <p:commandButton id="btnFechar" value="#{msgs.btnFechar}" onclick="dlgProcesso.hide()" style="width:90px;margin-bottom: 20px;" styleClass="centerButton"/>
                             </h:panelGrid>
                        
                         </h:panelGrid>

                </p:tab>
                    
            </p:tabView>
                
        </p:dialog>
            
    </h:form>
                
</html>

